﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MH.Lib.Actions;

namespace MH.Lib.Data
{
    public interface IPersonContainer
        : IEnumerable<IPerson>
    {
        /// <summary>
        /// Attempts to insert person to this container
        /// </summary>
        /// <param name="person"> Person data to insert </param>
        /// <returns> True if successful, false otherwise </returns>
        bool Insert(IPerson person);

        /// <summary>
        /// Determines whether person data with given ID exists in this container
        /// </summary>
        /// <param name="ID"> ID to look for </param>
        /// <returns> True if successful, false otherwise </returns>
        bool Contains(string ID);

        /// <summary>
        /// Attempts to find person data according to given ID
        /// </summary>
        /// <param name="ID"> ID to look for </param>
        /// <returns> Person data of found, null otherwise </returns>
        IPerson Find(string ID);

        /// <summary>
        /// Attempts to remove person from this container
        /// </summary>
        /// <param name="ID"> ID to look for </param>
        /// <returns> True if successful, false otherwise </returns>
        bool Remove(string ID);

        /// <summary>
        /// Clears this container
        /// </summary>
        void Clear();

        /// <summary>
        /// Attempts to apply given action for each person in this container
        /// </summary>
        /// <param name="action"> Action to apply </param>
        /// <returns> True if successful, false otherwise </returns>
        bool ApplyAll(IAction action);
    }
}
